//
//  BuyTableViewCell.m
//  项目A --半糖
//
//  Created by romana on 16/5/18.
//  Copyright © 2016年 romana. All rights reserved.
//

#import "BuyTableViewCell.h"

@implementation BuyTableViewCell


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self createSubviews];
        
    }
    return self;
}

-(void)createSubviews
{
    
    self.MyimageView = [[UIImageView alloc] init];
    self.MyimageView.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:self.MyimageView];
    
    self.BigLabel = [[BaseLabel alloc] init];
    self.BigLabel.backgroundColor = [UIColor clearColor];
    self.BigLabel.textAlignment = NSTextAlignmentCenter;
    self.BigLabel.layer.borderColor = [[UIColor whiteColor]CGColor];
    
    [self.contentView addSubview:self.BigLabel];
    
    self.SmallLabel = [[BaseLabel alloc] init];
    self.SmallLabel.backgroundColor = [UIColor clearColor];
   // self.SmallLabel.textAlignment = NSTextAlignmentCenter;
    self.SmallLabel.layer.borderColor = [[UIColor whiteColor]CGColor];
    
    [self.contentView addSubview:self.SmallLabel];
    
    self.smallImageV = [[UIImageView alloc] init];
    self.smallImageV.backgroundColor = [UIColor clearColor];
    self.smallImageV.image = [UIImage imageNamed:@"heart"];
    [self.contentView addSubview:self.smallImageV];
    
    
    
}

-(void)layoutSubviews{
    [super layoutSubviews];
    
    self.MyimageView.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height / 5 * 4);
    self.BigLabel.frame = CGRectMake(0, self.frame.size.height / 5 * 4, self.frame.size.width, self.frame.size.height / 10);
    self.SmallLabel.frame = CGRectMake(self.frame.size.width / 2 - 15, self.frame.size.height / 8 * 7 + 10, self.frame.size.width / 2, self.frame.size.height - self.frame .size.height / 8 * 7 - 10);
    self.smallImageV.frame = CGRectMake(self.frame.size.width / 2 - 45, self.SmallLabel.frame.origin.y + 3, 25, self.SmallLabel.frame.size.height - 3);
    
    
}

-(void)setBuySModel:(BuySecondModel *)buySModel{

    _buySModel = buySModel;
    
    self.BigLabel.text = _buySModel.title;
    self.SmallLabel.text = _buySModel.likes;
    [self.MyimageView sd_setImageWithURL:[NSURL URLWithString:_buySModel.pic]];



}





- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
